import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

/// 价钱组件
/// 默认图标 icon
/// 图标可选 true
/// 原价    amount
/// 现价    realAmount
/// 前面的標題
/// 後面的標題
class PriceWidget extends StatelessWidget {
  final String icon;
  final bool isIcon;
  final num amount;
  final realAmount;
  final String title;
  final String title2;
  const PriceWidget(
      {Key key,
      this.icon,
      this.isIcon,
      this.amount,
      @required this.realAmount,
      this.title, this.title2})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(padding: EdgeInsets.only(top: 10), child: price());
  }

  Widget price() {
    return Container(
      child: Row(
        children: [
          title == null
              ? Container()
              : Text(
                  title,
                  style: TextStyle(
                      color: Color(0xFFA5A5A5),
                      fontSize: ScreenUtil().setSp(12),
                      fontWeight: FontWeight.w600),
                ),
          Padding(
            padding: EdgeInsets.only(right: 5),
          ),
          Text(
            realAmount.toString(),
            style: TextStyle(
                color: Color(0xFFFE5000),
                fontSize: ScreenUtil().setSp(20)),
          ),
          Padding(
            padding: EdgeInsets.only(left: 5),
          ),
          amount == null
              ? Container()
              : amount == realAmount
                  ? Container()
                  : Text(
                      "$title2 $amount",
                      style: TextStyle(
                          color: Color(0xFFA5A5A5),
                          decoration: TextDecoration.lineThrough,
                          fontSize: ScreenUtil().setSp(12)),
                    )
        ],
      ),
    );
  }
}
